package heap;

import queue.Queue;

/**
 * 优先级队列的简单实现(最大堆)
 */
public class MyPriorityQueue implements Queue<Integer> {
    private MaxHeap heap;
    public MyPriorityQueue() {
        heap = new MaxHeap();
    }

    @Override
    public void offer(Integer val) {
        heap.add(val);
    }

    @Override
    public Integer poll() {
        return heap.extraMax();
    }

    @Override
    public Integer peek() {
        return heap.peek();
    }

    @Override
    public boolean isEmpty() {
        return heap.isEmpty();
    }
}
